{% extends "@CoreBundle/layout/main.html.twig" %}
{% import "@EduxBundle/macros/category_tree.html.twig" as macros %}

{% block page_title %}分类管理{% endblock %}

{% block head_stylesheets %}
	{{ parent() }}
	{{ encore_entry_link_tags('edux_admin_teach_category_index') }}
{% endblock %}

{% block body_javascript %}
	{{ parent() }}
	{{ encore_entry_script_tags('edux_admin_teach_category_index') }}
{% endblock %}

{% block body_custom_javascript %}
    <script>
var admin_api_teach_category_updateSort = '{{ path('admin_api_teach_category_updateSort') }}';
    </script>
{% endblock %}

{% block page %}
        <div class="row">
            <div class="col-md-6">
                <div class="card card-default">
                    <div class="card-header">
                        <div class="btn-group">
                            <button class="btn btn-primary btn-sm tree-tools" data-action="expand" title="展开">
                                <i class="mdi mdi-plus-box-outline"></i>&nbsp;展开
                            </button>
                            <button class="btn btn-primary btn-sm tree-tools active" data-action="collapse"
                                    title="收起">
                                <i class="mdi mdi-minus-box-outline"></i>&nbsp;收起
                            </button>
                        </div>
                        {% if is_authorized('admin_api_teach_category_updateSort') %}
                            <div class="btn-group">
                                <button class="btn btn-info btn-sm" id="sortSave" title="保存">
                                    <i class="mdi mdi-content-save"></i><span class="hidden-xs">&nbsp;保存排序 </span>
                                </button>
                            </div>
                        {% endif %}
                    </div>
                    <!-- /.box-header -->
                    <div class="card-body table-responsive">
                        <div class="dd" id="tree">
                            {{ macros.category_tree(categorys) }}
                        </div>
                    </div>
                    <!-- /.box-body -->
                </div>
            </div>
            {% if is_authorized('admin_api_teach_category_add') %}
            <div class="col-md-6">
                {{ addFormData|raw }}
            </div>
            {% endif %}
        </div>
{% endblock %}
